import request from '@/utils/request'

// 查询竞赛报名信息列表
export function listCompetitionSignup(query) {
  return request({
    url: '/race/competitionSignup/list',
    method: 'get',
    params: query
  })
}

// 查询竞赛报名信息详细
export function getCompetitionSignup(id) {
  return request({
    url: '/race/competitionSignup/' + id,
    method: 'get'
  })
}

// 新增竞赛报名信息
export function addCompetitionSignup(data) {
  return request({
    url: '/race/competitionSignup',
    method: 'post',
    data: data
  })
}

// 修改竞赛报名信息
export function updateCompetitionSignup(data) {
  return request({
    url: '/race/competitionSignup',
    method: 'put',
    data: data
  })
}

// 删除竞赛报名信息
export function delCompetitionSignup(id) {
  return request({
    url: '/race/competitionSignup/' + id,
    method: 'delete'
  })
}

// 根据竞赛ID查询报名信息
export function getSignupByCompetitionId(competitionId) {
  return request({
    url: '/race/competitionSignup/competition/' + competitionId,
    method: 'get'
  })
}

// 根据姓名查询报名信息
export function getSignupByName(participantName) {
  return request({
    url: '/race/competitionSignup/name/' + participantName,
    method: 'get'
  })
}

// 根据学校查询报名信息
export function getSignupBySchool(schoolName) {
  return request({
    url: '/race/competitionSignup/school/' + schoolName,
    method: 'get'
  })
}

// 获取报名统计信息
export function getSignupStatistics(competitionId) {
  return request({
    url: '/race/competitionSignup/statistics/' + competitionId,
    method: 'get'
  })
}

// 审核报名信息
export function auditSignup(id, status, auditRemark) {
  return request({
    url: '/race/competitionSignup/audit/' + id,
    method: 'put',
    data: {
      status: status,
      auditRemark: auditRemark
    }
  })
}

// 检查报名是否重复
export function checkDuplicateSignup(data) {
  return request({
    url: '/race/competitionSignup/checkDuplicate',
    method: 'post',
    data: data
  })
}
